//
//  SeckillCell.m
//  phmall
//
//  Created by admin on 2017/9/24.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "SeckillCell.h"

@implementation SeckillCell
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self){
        self.contentView.backgroundColor=[UIColor whiteColor];
        
        self.cellImage=[[UIImageView alloc]init];
        self.cellImage.image=[UIImage imageNamed:@"图片"];
        [self.contentView addSubview:self.cellImage];
        
        self.market_priceImg=[[UIImageView alloc]init];
        self.market_priceImg.image=[UIImage imageNamed:@"比索"];
        [self.contentView addSubview:self.market_priceImg];
        
        self.market_price=[[UILabel alloc]init];
        self.market_price.font=[UIFont systemFontOfSize:15];
        self.market_price.text=@"₱6666.00";
        self.market_price.textColor=[UIColor orangeColor];
        [self.contentView addSubview:self.market_price];
        
        self.price=[[UILabel alloc]init];
        self.price.font=[UIFont systemFontOfSize:12];
        self.price.text=@"₱6666.00";
        self.price.textColor=[UIColor colorWithHexString:@"#d2d2d2"];
        [self.contentView addSubview:self.price];

    }
    
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.contentView.frame.size;
    
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }


    [self.cellImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).with.offset(0);
        make.left.equalTo(self.contentView).with.offset(0);
        make.right.equalTo(self.contentView).with.offset(0);
        make.height.equalTo(self.cellImage.mas_width);
    }];
    
    [self.market_price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(10);
        make.top.equalTo(self.cellImage.mas_bottom).with.offset(5);
    }];
    
    [self.price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).with.offset(10);
        make.top.equalTo(self.market_price.mas_bottom).with.offset(5);
    }];
   
}
-(void)setModel:(GoodsModel *)model{
    _model=model;
    [self.cellImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@union/%@",IMGURL,model.goods_file1]] placeholderImage:[UIImage imageNamed:@"图片空白页"]];
    self.market_price.text=model.price;
    self.price.text=model.goods_sale_price;
//
}
@end
